<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //逻辑中断   与&&左边为false就中断(不再执行右边)，或||左边为true就中断(不再执行右边)
    function getSum(x, y) {
      x = x || 0
      y = y || 0
      console.log(x + y)
    }
    getSum(1, 2)
    getSum()
    console.log('--------------------------------------------')
    //左边中断
    console.log(false && 22)  //&&左边为false就中断
    console.log(false && 3 + 5)
    console.log(true || 11)  //||左边为true就中断
    console.log(5 > 3 || 4)
    console.log(444 || 555) //都是真，输出第一个真值
    console.log('--------------------------------------------')
    //左边不中断
    console.log(true && 11)
    console.log(11 && 22) //都是真，输出最后一个真值
    console.log(false || 33)
    console.log(5 !== 5 || 44)
    console.log('--------------------------------------------')
    let a = 18
    console.log(5 > 6 && a++)
    console.log(5 > 4 && a++)
    console.log(a)
    console.log('--------------------------------------------')
    let b = 20
    console.log(5 > 6 || b++)
    console.log(5 > 4 || b++)
    console.log(b)

  </script>
</body>

</html>